{{ $return := "" }}
{{ with site.Data.decap_cms_config }}
  {{ $return = . }}
{{ end }}

{{ $backend_opts := dict "branch" (site.Params.extensions.decap_cms.branch | default "main") }}

{{ with site.Params.extensions.decap_cms.publish_mode }}
  {{ $publish_mode := dict "publish_mode" . }}
  {{ $return = merge $return $publish_mode }}
{{ end }}

{{ $local_backend := false }}
{{ if site.Params.extensions.decap_cms.local_backend | or (not hugo.IsProduction) }}
  {{ $local_backend = true }}
{{ end }}
{{ $return = merge $return (dict "local_backend" $local_backend) }}

{{ $backend := dict "backend" $backend_opts }}
{{ $return := merge $return $backend }}

{{- return $return -}}
